//********************************************************************************************************************//
//ORGANIZATION:
//AUTHOR: bpeng(bogers.peng@gmail.com)
//SUMMARY:
//********************************************************************************************************************//
#ifndef NATIVE_DOMAIN_COMPILING_SQL_HEADER_H
#define NATIVE_DOMAIN_COMPILING_SQL_HEADER_H

#ifndef NATIVE_DOMAIN_COMPILING_COMMON_FIELD_H
#include "Domain/Compiling/Common/Field.h"
#endif

namespace Native { namespace Compiling { namespace Sql
{
    //****************************************************************************************************************//
    //CHeader
    //
    //****************************************************************************************************************//
    NATIVE_DECLARE_CONST_OBJECT(CVariable, C_VARIABLE);
    NATIVE_DECLARE_CONST_OBJECT(CHeader, C_HEADER);
    class NATIVE_LIBRARY_EXPORT CHeader :
        public CField,
        public IEqualTo<CHeader>
    {
        NATIVE_DECLARE_OBJECT;

        NATIVE_DECLARE_PROPERTY(public, public, CString, Name, _name);
        NATIVE_DECLARE_PROPERTY(public, public, CString, ReturnType, _return_type);

    protected:
        CMap<CString,CVariable> _variables;

    public:
        CHeader();
        CHeader(C_HEADER& that);
        CHeader(C_HEADER&& that);
        virtual ~CHeader();
        //{Object
        virtual wstring ToString() const;
        //}
        //{IEqualTo
        virtual bool operator==(C_HEADER& rvalue) const;
        virtual bool operator!=(C_HEADER& rvalue) const;
        //}
        //{CField
        virtual void Clear();
        virtual CString ToCode() const;
        //}
        void Append(C_VARIABLE& variable) throw();
        CArray<CVariable> Query(C_STRING& name) const throw();

        C_HEADER& operator=(C_HEADER& rvalue);
    };
}}}

#endif